home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / Missile Defender.swf / scripts / frame_262 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  10.3 KB  |  371 lines

  1. delay = getTimer();
  2. number = int("100" - (recharge - delay) / "20");
  3. if("30" < number and number < "60")
  4. {
  5.    tellTarget("/sounds")
  6.    {
  7.       gotoAndPlay("Recharge_sound");
  8.    }
  9. }
  10. tellTarget("/small_interface/recharge")
  11. {
  12.    gotoAndStop(eval("/:number"));
  13. }
  14. if(fire == "1" or fire1 == "1")
  15. {
  16.    if(first_step == "1")
  17.    {
  18.       alpha = eval("/dialctrl:alpha");
  19.    }
  20.    if("90" < alpha)
  21.    {
  22.       sign = - "1";
  23.       angle_l = "180" - alpha;
  24.    }
  25.    else if("90" >= alfa)
  26.    {
  27.       sign = "1";
  28.       angle_l = alpha;
  29.    }
  30.    x0_l = getProperty("/dialctrl", _X) + sign * "43.6" * eval("cos" add angle_l);
  31.    y0_l = getProperty("/dialctrl", _Y) - "43.6" * eval("sin" add angle_l);
  32.    if(first_step == "1")
  33.    {
  34.       setProperty("/laser1", _rotation, "180" - alpha);
  35.       x_l = x0_l + sign * getProperty("/laser1", _width);
  36.       y_l = y0_l - getProperty("/laser1", _height);
  37.       x_l1 = x0_l + sign * getProperty("/laser1", _width) / "2";
  38.       y_l1 = y0_l - getProperty("/laser1", _height) / "2";
  39.       x_l2 = x0_l;
  40.       y_l2 = y0_l;
  41.       first_step = "0";
  42.       tellTarget("/sounds")
  43.       {
  44.          gotoAndPlay("Laser_sound");
  45.       }
  46.    }
  47.    k = "0";
  48.    while("15" >= k)
  49.    {
  50.       k += "1";
  51.       rocket_width = getProperty("/rocket1", _width);
  52.       rocket_height = getProperty("/rocket1", _height);
  53.       x_l += sign * getProperty("/laser1", _width) / rocket_width;
  54.       y_l -= getProperty("/laser1", _height) / rocket_width;
  55.       x_l1 += sign * getProperty("/laser1", _width) / rocket_width;
  56.       y_l1 -= getProperty("/laser1", _height) / rocket_width;
  57.       x_l2 += sign * getProperty("/laser1", _width) / rocket_width;
  58.       y_l2 -= getProperty("/laser1", _height) / rocket_width;
  59.       test1 = x_r1 - x_l;
  60.       test2 = x_l - x_r1 + rocket_width;
  61.       test3 = y_l - y_r1;
  62.       test4 = y_r1 + rocket_height - y_l;
  63.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  64.       {
  65.          test = "1";
  66.       }
  67.       test1 = x_r1 - x_l1;
  68.       test2 = x_l1 - x_r1 + rocket_width;
  69.       test3 = y_l1 - y_r1;
  70.       test4 = y_r1 + rocket_height - y_l1;
  71.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  72.       {
  73.          test = "1";
  74.       }
  75.       test1 = x_r1 - x_l2;
  76.       test2 = x_l2 - x_r1 + rocket_width;
  77.       test3 = y_l2 - y_r1;
  78.       test4 = y_r1 + rocket_height - y_l2;
  79.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  80.       {
  81.          test = "1";
  82.       }
  83.       test1 = x_r2 - x_l;
  84.       test2 = x_l - x_r2 + rocket_width;
  85.       test3 = y_l - y_r2;
  86.       test4 = y_r2 + rocket_height - y_l;
  87.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  88.       {
  89.          test = "2";
  90.       }
  91.       test1 = x_r2 - x_l1;
  92.       test2 = x_l1 - x_r2 + rocket_width;
  93.       test3 = y_l1 - y_r2;
  94.       test4 = y_r2 + rocket_height - y_l1;
  95.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  96.       {
  97.          test = "2";
  98.       }
  99.       test1 = x_r2 - x_l2;
  100.       test2 = x_l2 - x_r2 + rocket_width;
  101.       test3 = y_l2 - y_r2;
  102.       test4 = y_r2 + rocket_height - y_l2;
  103.       if(test1 >= "0" and test2 >= "0" and test3 >= "0" and test4 >= "0")
  104.       {
  105.          test = "2";
  106.       }
  107.       if(test == "1" or test == "2")
  108.       {
  109.          no_test += test;
  110.          fire = "0";
  111.          colision = "1";
  112.          fire1 = "0";
  113.          k = "20";
  114.          x_l = "1000";
  115.          y_l = "0";
  116.          score += "100" - beta;
  117.          set("/small_interface:score",score);
  118.          no_hit_rocket = no_hit_rocket - int(no_hit_rocket / "6") * "6" + "1";
  119.          set("/small_interface:message",eval("hit_rocket_message" add no_hit_rocket));
  120.          if(test == "1")
  121.          {
  122.             setProperty("/explosion_air", _X, x_r1 - getProperty("/rocket1", _width) / "2");
  123.             setProperty("/explosion_air", _Y, y_r1 + getProperty("/rocket1", _height) / "2");
  124.             x_r1 = x0_r1 - "100";
  125.             y_r1 = y0_r1 - "100";
  126.             setProperty("/rocket1", _X, x_r1);
  127.             setProperty("/rocket1", _Y, y_r1);
  128.          }
  129.          else if(test == "2")
  130.          {
  131.             setProperty("/explosion_air", _X, x_r2 - getProperty("/rocket2", _width) / "2");
  132.             setProperty("/explosion_air", _Y, y_r2 + getProperty("/rocket2", _height) / "2");
  133.             x_r2 = x0_r2 - "100";
  134.             y_r2 = y0_r2 - "100";
  135.             setProperty("/rocket2", _X, x_r2);
  136.             setProperty("/rocket2", _Y, y_r2);
  137.          }
  138.          tellTarget("/explosion_air")
  139.          {
  140.             gotoAndPlay(2);
  141.          }
  142.          if(no_test >= "3")
  143.          {
  144.             gotoAndPlay(259);
  145.          }
  146.          else if(no_test < "3")
  147.          {
  148.             if(no_test == "1")
  149.             {
  150.                x_r1 = x0_r1 - "100";
  151.                y_r1 = y0_r1 - "100";
  152.                setProperty("/rocket1", _X, x_r1);
  153.                setProperty("/rocket1", _Y, y_r1);
  154.             }
  155.             else if(no_test == "2")
  156.             {
  157.                x_r2 = x0_r2 - "100";
  158.                y_r2 = y0_r2 - "100";
  159.                setProperty("/rocket2", _X, x_r2);
  160.                setProperty("/rocket2", _Y, y_r2);
  161.             }
  162.             gotoAndPlay(261);
  163.          }
  164.       }
  165.       test = "0";
  166.    }
  167.    setProperty("/laser1", _X, x_l);
  168.    setProperty("/laser1", _Y, y_l);
  169.    colision = "0";
  170.    test = "0";
  171.    fire1 = "1";
  172. }
  173. beta = i * angle_step;
  174. if(beta >= "89")
  175. {
  176.    if(no_test == "2" or no_test == "0")
  177.    {
  178.       y_r1 += rase * eval("sin" add angle_step);
  179.    }
  180.    if((no_test == "1" or no_test == "0") and no_level == "2")
  181.    {
  182.       y_r2 += rase * eval("sin" add angle_step);
  183.    }
  184.    angle_r = "180";
  185. }
  186. else if(beta < "89")
  187. {
  188.    if(no_test == "2" or no_test == "0")
  189.    {
  190.       x_r1 = x0_r1 - rase * (eval("sin" add beta) - eval("sin" add "10"));
  191.       y_r1 = y0_r1 + rase - rase * eval("cos" add beta);
  192.    }
  193.    if((no_test == "1" or no_test == "0") and no_level == "2")
  194.    {
  195.       x_r2 = x0_r2 - rase * (eval("sin" add beta) - eval("sin" add "10"));
  196.       y_r2 = y0_r2 + rase - rase * eval("cos" add beta);
  197.    }
  198.    angle_r = "270" - beta;
  199. }
  200. if(no_test == "2" or no_test == "0")
  201. {
  202.    setProperty("/rocket1", _X, x_r1);
  203.    setProperty("/rocket1", _Y, y_r1);
  204.    setProperty("/rocket1", _rotation, angle_r);
  205. }
  206. if((no_test == "1" or no_test == "0") and no_level == "2")
  207. {
  208.    setProperty("/rocket2", _X, x_r2);
  209.    setProperty("/rocket2", _Y, y_r2);
  210.    setProperty("/rocket2", _rotation, angle_r);
  211. }
  212. i += "1";
  213. if("380" < y_r1)
  214. {
  215.    if(x_r1 < "350" and x_r1 >= "0")
  216.    {
  217.       no_test += "1";
  218.       no_hit_rocket = "0";
  219.       life -= "1";
  220.       score -= "50";
  221.       if(score < "0")
  222.       {
  223.          score = "0";
  224.       }
  225.       set("/small_interface:score",score);
  226.       setProperty("/explosion_city1", _X, x_r1 + "28");
  227.       setProperty("/explosion_city1", _Y, y_r1);
  228.       tellTarget("/explosion_city1")
  229.       {
  230.          gotoAndPlay(2);
  231.       }
  232.       tellTarget("/city")
  233.       {
  234.          nextFrame();
  235.       }
  236.       fire1 = "1";
  237.       x_r1 = x0_r1 - "100";
  238.       y_r1 = y0_r1 - "100";
  239.       if(no_test >= "3")
  240.       {
  241.          gotoAndPlay(259);
  242.       }
  243.    }
  244.    else if(x_r1 >= "350" and "640" >= x_r1)
  245.    {
  246.       no_test += "1";
  247.       score -= "20";
  248.       if(score < "0")
  249.       {
  250.          score = "0";
  251.       }
  252.       set("/small_interface:score",score);
  253.       no_miss_city = no_miss_city - int(no_miss_city / "2") * "2" + "1";
  254.       set("/small_interface:message",eval("miss_message" add no_miss_city));
  255.       setProperty("/explosion_ground", _X, x_r1);
  256.       setProperty("/explosion_ground", _Y, y_r1);
  257.       tellTarget("/explosion_ground")
  258.       {
  259.          gotoAndPlay(2);
  260.       }
  261.       fire1 = "1";
  262.       x_r1 = x0_r1 - "100";
  263.       y_r1 = y0_r1 - "100";
  264.       if(no_test >= "3")
  265.       {
  266.          gotoAndPlay(259);
  267.       }
  268.    }
  269.    else if(x_r1 < "0" or "640" < x_r1)
  270.    {
  271.       x_r1 = x0_r1 - "100";
  272.       y_r1 = y0_r1 - "100";
  273.       setProperty("/rocket1", _X, x_r1);
  274.       setProperty("/rocket1", _Y, y_r1);
  275.       no_test += "1";
  276.       no_miss_city = no_miss_city - int(no_miss_city / "2") * "2" + "1";
  277.       set("/small_interface:message",eval("miss_message" add no_miss_city));
  278.       if(no_test >= "3")
  279.       {
  280.          gotoAndPlay(259);
  281.       }
  282.    }
  283. }
  284. if("380" < y_r2)
  285. {
  286.    if(x_r2 < "350" and x_r2 >= "0")
  287.    {
  288.       no_test += "2";
  289.       no_hit_rocket = "0";
  290.       life -= "1";
  291.       score -= "50";
  292.       if(score < "0")
  293.       {
  294.          score = "0";
  295.       }
  296.       set("/small_interface:score",score);
  297.       setProperty("/explosion_city2", _X, x_r2 + "15");
  298.       setProperty("/explosion_city2", _Y, y_r2);
  299.       tellTarget("/explosion_city2")
  300.       {
  301.          gotoAndPlay(2);
  302.       }
  303.       tellTarget("/city")
  304.       {
  305.          nextFrame();
  306.       }
  307.       fire1 = "1";
  308.       x_r2 = x0_r2 - "100";
  309.       y_r2 = y0_r2 - "100";
  310.       if(no_test >= "3")
  311.       {
  312.          gotoAndPlay(259);
  313.       }
  314.       else if(no_test < "3")
  315.       {
  316.          gotoAndPlay(261);
  317.       }
  318.    }
  319.    else if(x_r2 >= "350" and "640" >= x_r2)
  320.    {
  321.       no_test += "2";
  322.       score -= "20";
  323.       if(score < "0")
  324.       {
  325.          score = "0";
  326.       }
  327.       set("/small_interface:score",score);
  328.       no_miss_city = no_miss_city - int(no_miss_city / "2") * "2" + "1";
  329.       set("/small_interface:message",eval("miss_message" add no_miss_city));
  330.       setProperty("/explosion_ground", _X, x_r2);
  331.       setProperty("/explosion_ground", _Y, y_r2);
  332.       tellTarget("/explosion_ground")
  333.       {
  334.          gotoAndPlay(2);
  335.       }
  336.       fire1 = "1";
  337.       x_r2 = x0_r2 - "100";
  338.       y_r2 = y0_r2 - "100";
  339.       if(no_test >= "3")
  340.       {
  341.          gotoAndPlay(259);
  342.       }
  343.       else if(no_test < "3")
  344.       {
  345.          gotoAndPlay(261);
  346.       }
  347.    }
  348.    else if(x_r2 < "0" or "640" < x_r2)
  349.    {
  350.       x_r2 = x0_r2 - "100";
  351.       y_r2 = y0_r2 - "100";
  352.       setProperty("/rocket2", _X, x_r2);
  353.       setProperty("/rocket2", _Y, y_r2);
  354.       no_test += "2";
  355.       no_miss_city = no_miss_city - int(no_miss_city / "2") * "2" + "1";
  356.       set("/small_interface:message",eval("miss_message" add no_miss_city));
  357.       if(no_test >= "3")
  358.       {
  359.          gotoAndPlay(259);
  360.       }
  361.       else if(no_test < "3")
  362.       {
  363.          gotoAndPlay(261);
  364.       }
  365.    }
  366. }
  367. else
  368. {
  369.    gotoAndPlay(261);
  370. }
  371.